#pragma once
#include "VComplexWidget.h"



class VButton :
    public VComplexWidget
{
public:
    VButton(void);

    virtual ~VButton(void);

public:
    virtual void init();
    virtual bool render() const;

    virtual bool loadTexture(const std::string& normal, const std::string& pressed = std::string());

public:
    virtual void setClickHandler(mouse_event_t handler);

    virtual void setNoPopup(bool no_popup = true);
    virtual bool noPopup() const;

    virtual void setStatus(bool status);
    virtual bool status() const;

    virtual void setHavePicture(bool havepicture = true);
    virtual bool havePicture();


    virtual void move(int x, int y);
    virtual void resize(int w, int h);

    virtual VPicture* currentPicture();
    virtual VPicture* normalPicture();
    virtual VPicture* pressedPicture();

public:
    virtual bool mouseDownEvent(int x, int y);
    virtual bool mouseUpEvent(int x, int y);

protected:
    bool _pressed;
    VPicture* _pic1, *_pic2;
    void* _privatedata;
    mouse_event_t _clickevent;
    bool _nopopup;
    bool _status;
    bool _havepic;
};
